fix(desktop): scope the mention picker to the current relay's managed agents - #5720
Open
Chessing234 wants to merge 2 commits into
Open
fix(desktop): scope the mention picker to the current relay's managed agents#5720Chessing234 wants to merge 2 commits into
Chessing234 wants to merge 2 commits into
Conversation
managed-agents.json is one file per install and every record keeps the relay URL its keypair was minted against. Changing a community's relay URL mints new keypairs and appends them without removing the old rows, so a reader of the whole file sees one entry per historical relay. Add the pure filter for that. Comparison is canonical, so localhost vs 127.0.0.1, a default port, and a trailing slash still match. An unknown active relay or an unreadable record URL keeps entries rather than dropping them: hiding a real agent is worse than showing a stale one. Refs block#5488 Signed-off-by: Taksh <takshkothari09@gmail.com>
useMentions read the whole managed-agent file, so every keypair minted against a previous relay URL kept appearing in the @ picker: three communities' worth of Fizz/Honey/Bumble under different npubs, all labelled "managed by you - not in channel". None of them are reachable on the relay the user is connected to, so picking one produces a mention that cannot be delivered. Filter the list to the active community's relay once, and derive the name, persona, and pubkey lookups from the scoped list. Closes block#5488 Signed-off-by: Taksh <takshkothari09@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
managed-agents.jsonis one file per install and every record keeps the relay URL its keypair was minted against. Changing a community's relay URL mints new keypairs and appends them without removing the old rows, anduseMentionsread the whole file — so the@picker showed one entry per historical relay: three communities'-worth of Fizz/Honey/Bumble under different npubs, all labelled "managed by you · not in channel". None of the stale ones are reachable on the relay the user is connected to.Filter the list to the active community's relay once, and derive the name, persona-id, and pubkey lookups (and the
mentionableAgentPubkeysset built from them) off the scoped list.managedAgentsForRelaycompares canonically via the existingcanonicalRelayUrl, solocalhostvs127.0.0.1, a default port, and a trailing slash still match the same relay. It deliberately fails open in two places, each covered by a test:relayUrlwill not parse is kept, so a real agent is never hidden on the strength of a URL we failed to read.This is the issue's second suggested fix (scope the picker). It does not clean up
managed-agents.json— the stale records stay on disk and stay startable from the Agents view, which felt like the wrong thing to decide inside a mention picker. Happy to follow up with the removal/archive path if you would rather fix it at the source.Verified locally in
desktop/:pnpm typecheck,pnpm check, andpnpm test(4721 pass, including the 5 new ones). I did not build or run the Tauri app.Closes #5488